<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-user_id" data-rule="required" {if $row.is_apply == 1} disabled {/if} data-source="user/user/index" data-search-field="u.mobile,ua.real_name" data-pagination="true" data-primary-key="id" data-field="ushowfiled" class="form-control selectpage" name="row[user_id]" type="text" value="{$row.user_id|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">返点率提示:</label>
        <div class="col-xs-12 col-sm-8">
            <label class="control-label" id="rate-tip" style="color:red;">当前代理区门店最大返点率为:0.00,代理返点 + 门店返点 <= 100 </label>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">返点率:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-rate" data-rule="required" class="form-control" step="0.01" name="row[rate]" type="number" value="{$row.rate|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('省市区')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="form-inline" data-toggle="cxselect" data-selects="province,city,area">
                <select class="province form-control"  name="row[province]" data-url="ajax/area">
                    <option value="{$row.province|htmlentities}"></option>
                </select>
                <select class="city form-control"  name="row[city]" data-query-name="province" data-url="ajax/area">
                    <option value="{$row.city|htmlentities}"></option>
                </select>
                <select class="area form-control"  name="row[district]" data-query-name="city" data-url="ajax/area" onchange="getMaxRate(this.value)">
                    <option value="{$row.district|htmlentities}"></option>
                </select>
            </div>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
        <div class="col-xs-12 col-sm-8">
            
            <div class="radio">
            {foreach name="statusList" item="vo"}
            <label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="$row.status"}checked{/in} /> {$vo}</label> 
            {/foreach}
            </div>

        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Reason')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-reason" data-rule="required" class="form-control" name="row[reason]" type="text" value="{$row.reason|htmlentities}">
        </div>
    </div>
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
        </div>
    </div>
</form>
<script>
    function getMaxRate(area_id) {
        $.get("{:url('ajax/maxrate')}", {area_id: area_id}, function (res) {
            $("#rate-tip").val('当前代理区最大门店返点率为:'+ res.data.max_rate +',代理返点 + 门店返点 <= 100' );
        });
    }
</script>
